package com.example.search.dao;

import com.example.search.model.Goods;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

/**
 * @Auther: nanhuanh
 * @Date: 2019/3/6 16:03
 * @Description:
 */
@Repository
public interface GoodsRepository extends ElasticsearchRepository<Goods, String> {

    @Query("{\"query\":{\"match\":{\"shopName\":\"?0\"}}}")
    Page<Goods> findByGoodsName(String shopName, Pageable pageable);

    @Query("{\"query\":{\"match\":{\"shopCode\":\"?0\"}}}")
    Page<Goods> findByShopCode(String shopCode, Pageable pageable);

}
